package edu.mapi.aamas.common;

import java.io.Serializable;
/**
 * @author ZP
 */
public class Proposal implements Serializable, Comparable<Proposal> {
	
	public double timeToComplete = Double.MAX_VALUE;
	public double fuelAfterCompletion = Double.MIN_VALUE;
	public String vehicleId = "unknown";
	public String taskId = "unknown";
	
	public Proposal(String taskId, String vehicleId, double timeToComplete, double fuelAfterComplete) {
		this.taskId = taskId;
		this.vehicleId = vehicleId;
		this.fuelAfterCompletion = fuelAfterComplete;
		this.timeToComplete = timeToComplete;
	}
	
	public int compareTo(Proposal o) {
		if (o.fuelAfterCompletion < 0) {
			if (this.fuelAfterCompletion < 0)
				return 0;
			else
				return 1;
		}
		
		if (o.fuelAfterCompletion > 0 && this.fuelAfterCompletion < 0)
			return -1;
		
		return (int)Math.signum(o.timeToComplete - timeToComplete);
	}
	
	public String toString() {
		return "(delay="+(int)timeToComplete+", fuelAfter="+(int)fuelAfterCompletion+")";
	}
}
